Switching languages

For each language to be used in a document a control sequence of the form \l@ :〉!:}language has to be defined. This will either be done while loading hyphenation patterns or while loading the language-specific file. The implementation of \selectlanguage{ :〉!:}language} and
\iflanguage{ :〉!:}language}{ :〉!:}then case}{ :〉!:}else case} is based on the existence of \l@ :〉!:}language.

Figure: The definition of \selectlanguage.
\begin{figure*}\begin{verbatim}\def\selectlanguage ...

To switch from one language to another the macro \selectlanguage is available. Its definition can be seen in figure [*]. The first action it takes is to check whether the :〉!:}language is known, if it is not an error is signalled. If the language is known \originalTeX is called upon to reset any previously set language-specific definitions. Next the register \language is updated and the three macros that should activate all language-specific definitions are executed. Finally the macro \originalTeX receives a new replacement text in order to be able to deactivate the definitions just activated.

Figure: The definition of \iflanguage
\begin{figure*}\begin{verbatim}\def\iflanguage ...

The macro \iflanguage (see figure [*]) will issue a warning when its argument is an `unkown' language. It then goes on to compare the value of \language and \l@ :〉!:}language and executes either its secon or third argument.